from common.common_operation import CommonOperation
from common.read_xmind import ReadXmind
from common.test_data import TestData

test_data = TestData()


class DateOperation(CommonOperation):

    def generate_case(self, model_data, data_step, need_data,case_data):
        # TODO 是否必填
        self.required(need_data, model_data, data_step, '', case_data)
        # TODO 生成日期
        case_title = "{},{}:{}，{}".format(model_data['用例标题'], data_step, test_data.test_data('日期'),
                                          model_data['结果']['成功'])
        self.step_common(model_data, data_step, test_data.test_data(need_data['类型']['value']), '成功', case_data,
                         case_title)

    def case(self):
        return self.operation_type('日期时间选择器', self.generate_case)


def result():
    return DateOperation().case()


if __name__ == '__main__':
    import json

    ReadXmind(path=r'C:\Users\admin\Desktop\NAVS.xmind', sheet='日期时间选择器').processed_data()
    test = result()
    print(json.dumps(test, ensure_ascii=False))
